<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>忘记密码</title>
    <link rel="stylesheet" href="/static/new/css/common.css">
    <link rel="stylesheet" href="/static/new/css/swiper.min.css">
    <script src="/static/new/js/jquery.js"></script>
    <script src="/static/new/js/swiper.min.js"></script>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
</head>
<body>
<div class="sectionY">
    <!--    <a href="">
            <img src="/static/new/images/ak3.png" alt="" class="a1_d">
        </a>-->
    <p class="p1">忘记密码</p>
</div>
<div class="kong1"></div>
<div class="res_section1">
    <div class="layui-form">
        <div class="f1 clearfix">
            <input type="text" class="input1" name="nickname" id="nickname"  placeholder="请输入会员编号"/>
        </div>
        <div class="f1 clearfix">
            <input type="text" class="input1" name="mobile" id="mobile" value="" placeholder="请输入会员手机号"/>
        </div>
        <div class="f1 clearfix">
            <input type="text" class="input1" name="code" placeholder="验证码">
            <input type="button" id="btn" value="获取验证码" onclick="settime(this)" class="sr_btn"/>
        </div>
        <div class="f1 clearfix">
            <input type="password" class="input1" name="password" id="password" value="" placeholder="请输入密码"/>
            <img src="/static/new/images/register_icon_view_open.png" alt="" class="eye_btn eye_btn1">
            <img src="/static/new/images/register_icon_view_close.png" alt="" class="eye_btn eye_btn2">
        </div>
        <div class="f1 clearfix">
            <input type="password" class="input1" name="twopassword" id="twopassword" value="" placeholder="请输入交易密码"/>
            <img src="/static/new/images/register_icon_view_open.png" alt="" class="eye_btn eye_btn1">
            <img src="/static/new/images/register_icon_view_close.png" alt="" class="eye_btn eye_btn2">
        </div>
        <div class="sub">
            <input type="submit" lay-filter="sub" lay-submit value="立即找回">
        </div>
        <div class="last">
            <p class="p1">
                想起来了？去
                <a href="{:url('index')}">登录</a>
            </p>
        </div>
    </div>
</div>
</body>
<script>
    $(function(){
        // 密码框切换
        $(".eye_btn1").click(function(){
            $(this).hide().siblings("input").attr("type","text").siblings(".eye_btn2").show();
        })
        $(".eye_btn2").click(function(){
            $(this).hide().siblings("input").attr("type","password").siblings(".eye_btn1").show();
        })
    })
</script>

<script src="/static/mobile/js/mui.min.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form,$ = layui.jquery;
        // 登录提交监听
        form.on('submit(sub)', function (data) {
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("{:url('forget')}",data.field,function(res){
                layer.close(loading);
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        location.href = "{:url('index/index')}";
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                    $('.captcha img').attr('src','{:url("verify")}?id='+Math.random());
                }
            });
        })
    })
</script>

<script>

    mui.init({
        swipeBack:true //启用右滑关闭功能
    });
</script>

<script type="text/javascript">
    var countdown = 60;
    function settime(obj) {
        obj.setAttribute("disabled", true);
        /*ajax发短信
         */
        var mobile=$('#mobile').val();
        if(mobile==''){
            layer.msg("请输入手机号码",{time:1000,icon:2});
            obj.removeAttribute("disabled");
            return false;
        }
        $.ajax({
            type : "POST",  //请求方式
            async:false,
            url : "{:url('duanxin2')}",  //请求路径
            dataType:"html",
            data :{mobile:mobile,type:2},
            success : function(msg) {  //异步请求成功执行的回调函数
                var jsonParseJson=JSON.parse(msg);
                if(jsonParseJson['success']==1){
                    /*				layer.msg(jsonParseJson['msg'],{time:1000,icon:1},function(){
                     location.href = "{:url('jihuo')}";
                     });*/
                    layer.msg(jsonParseJson['msg'],{time:1000,icon:1});
                }else{
                    layer.msg(jsonParseJson['msg'],{time:1000,icon:2});
                }

            }
        });
        var id=setInterval(function() {
            if(countdown==0){
                obj.removeAttribute("disabled");
                obj.value="获取验证码";
                clearInterval(id);
            }else{
                obj.value="重新发送(" + countdown + ")";
                countdown--;
            }
        },1000);
    }

</script>
</html>